home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_03_01
/
3n01034a
< prev
next >
Wrap
Text File
|
1991-12-01
|
889b
|
33 lines
/*** Listing #4
*/
/*** vShftJis2Jis - Converts Shift JIS code to JIS.
*
* purpose: Converts a char Shift JIS code to its corresponding
* JIS code.
* parameters: pcShJis: Pointer to shift JIS code.
* pcJis : Pointer to Jis code for return.
* return: None
* modified:
*/
void vShftJis2Jis (
DBC *pcShJis, /* pointer to Shift JIS code */
DBC *pcJis) /* pointer to JIS code for return */
{
int c1, c2;
c1 = (*pcShJis++) & 0xff;
c2 = (*pcShJis) & 0xff;
if (c2 <= 0x9e) {
c1 = (c1 <= 0x9f) ? (c1 - 0x71)*2+1 : (c1-0xb1)*2+1;
c2 -= 0x1f;
if (c2 >= 0x61)
c2--;
} else {
c1 = (c1 <= 0x9f) ? (c1-0x70)*2 : (c1-0xb0)*2;
c2 -= 0x7e;
}
pcJis[0] = c1;
pcJis[1] = c2;
} /* vShftJis2Jis */